Array.prototype.MyFilter = function (callback, thisArg) {
    if (typeof this !== undefined) {
        throw new TypeError('调用MyFilter方法出错')
    }
    if (typeof callback !== 'function') {
        throw new TypeError('回调函数不是一个方法')
    }
    const res = [];
    const O = Object(this);
    let len = O.length
    for (let i = 0; i < len; i++) {
        if (i in O) {
            if (callback.call(thisArg, O[i], i, O)) {
                res.push(O[i])
            }
        }
    }
    return res
}